package com.controller;

import com.service.InventoryService;

import com.vo.InventoryVO;
import com.vo.QueryVo;
import com.vo.ResultVo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
@RequestMapping("inventory")
@ResponseBody
public class InventoryController {
    
    @Resource
    private InventoryService inventoryService;
    
    @RequestMapping(value = "list" , method = RequestMethod.GET)
    public ResultVo<InventoryVO> queryByPage(Integer pageNum , Integer pageSize, QueryVo vo){
        
        if(pageNum == null || pageNum <= 0){
            pageNum = 1;
        }
        if (pageSize == null || pageSize <= 0){
            pageSize = 5;
        }
        
        return new ResultVo<>(inventoryService.queryByPage(pageNum , pageSize , vo));
    }
    
}
